﻿Public NotInheritable Class LR1TransitionTableRow

    Private m_index As Integer
    Public Property Index() As Integer
        Get
            Return m_index
        End Get
        Friend Set(ByVal value As Integer)
            m_index = value
        End Set
    End Property

    Private ReadOnly m_stateRef As LR1State
    Public ReadOnly Property StateReference() As LR1State
        Get
            Return m_stateRef
        End Get
    End Property

    Private ReadOnly m_transitions As HashSet(Of LR1Transition)
    Public ReadOnly Property Transitions() As HashSet(Of LR1Transition)
        Get
            Return m_transitions
        End Get
    End Property

    Private ReadOnly m_reduces As List(Of Reduce)
    Public ReadOnly Property Reduces() As List(Of Reduce)
        Get
            Return m_reduces
        End Get
    End Property

    Private ReadOnly m_shifts As List(Of LR1Shift)
    Public ReadOnly Property Shifts() As List(Of LR1Shift)
        Get
            Return m_shifts
        End Get
    End Property

    Private ReadOnly m_gotos As List(Of LR1Goto)
    Public ReadOnly Property Gotos() As List(Of LR1Goto)
        Get
            Return m_gotos
        End Get
    End Property

    Private m_actionTable As Dictionary(Of ProductionSymbol, ILR1Action)
    Public ReadOnly Property Actions(ByVal symbol As ProductionSymbol) As ILR1Action
        Get
            If m_actionTable.ContainsKey(symbol) Then
                Return m_actionTable(symbol)
            Else
                Return Nothing
            End If
        End Get
    End Property

    Friend Sub SetActions(ByVal actionTable As Dictionary(Of ProductionSymbol, ILR1Action))
        m_actionTable = actionTable
    End Sub


    Public Sub New(ByVal stateRef As LR1State)
        m_stateRef = stateRef
        m_transitions = New HashSet(Of LR1Transition)
        m_reduces = New List(Of Reduce)
        m_shifts = New List(Of LR1Shift)
        m_gotos = New List(Of LR1Goto)
    End Sub
End Class